function i(i, t, n) {
    return t in i ? Object.defineProperty(i, t, {
        value: n,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : i[t] = n, i;
}

var t = getApp(), n = require("../../A4730AC3A71FB5DFC21562C4223CA4D1.js"), a = require("../../0BACB9C3A71FB5DF6DCAD1C4BE4CA4D1.js");

Page({
    data: {
        code1: "",
        msgCode1: null,
        msg1: "",
        isLoading1: !1,
        code2: "",
        msgCode2: null,
        msg2: "",
        isLoading2: !1,
        isLogin: !1,
        isLogining: !1
    },
    onLoad: function() {
        var i = this, n = t.globalData.isLogin;
        this.setData({
            isLogin: n
        }, function() {
            n ? (i.getCode(0, !0), i.getCode(1, !0)) : i.login();
        });
    },
    onShow: function() {
        null !== a._cb && (this.setData({
            isLogining: !1,
            isLoading1: !1,
            isLoading2: !1
        }), a._cb = null);
    },
    onShareAppMessage: function() {},
    login: function() {
        var i = this;
        t.globalData.isLogin || this.data.isLogining || this.setData({
            isLogining: !0
        }, function() {
            a.login(function(t) {
                i.setData({
                    isLogining: !1
                }), 1001 === t && i.setData({
                    isLogin: !0
                }, function() {
                    i.getCode(0, !0), i.getCode(1, !0);
                });
            });
        });
    },
    handleCode: function(i) {
        this.getCode(1 * i.currentTarget.dataset.type);
    },
    getCode: function(a, o) {
        var e = this;
        this.data["isLoading" + (a + 1)] ? wx.showToast({
            title: "正在更新" + (0 === a ? "未付款" : "已付款") + "的二维码，请稍后重试",
            icon: "none"
        }) : t.globalData.isLogin ? (this.setData(i({}, "isLoading" + (a + 1), !0)), wx.showLoading(), 
        n.get("/v1/currency/qrcode", {
            type: a
        }).then(function(t) {
            var n;
            wx.hideLoading(), e.setData((n = {}, i(n, "isLoading" + (a + 1), !1), i(n, "msgCode" + (a + 1), t.data.code), 
            i(n, "msg" + (a + 1), t.data.msg), n)), 1001 === t.data.code && (e.setData(i({}, "code" + (a + 1), "data:" + t.data.response.data)), 
            o || wx.showToast({
                title: "更新" + (0 === a ? "未付款" : "已付款") + "二维码完成",
                icon: "none"
            }));
        }).catch(function() {
            var t;
            wx.hideLoading(), e.setData((t = {}, i(t, "isLoading" + (a + 1), !1), i(t, "msgCode" + (a + 1), 1), 
            i(t, "msg" + (a + 1), "请求超时，请重试"), t));
        })) : this.login();
    }
});